package com.darling.danotebackend.common;

import com.darling.danotebackend.exception.ErrorCode;
import lombok.Data;

import java.io.Serializable;

/**
 * @Author: Darling达
 * @Date: 2025-02-08 2025-02-08
 * @Description: 全局相应封装类
 */
@Data
public class BaseResponse<T> implements Serializable {
    
    private int code;
    
    private T data;
    
    private String message;
    
    public BaseResponse(int code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }
    
    public BaseResponse(int code, T data) {
        this(code, data, "");
    }
    
    public BaseResponse(ErrorCode errorCode) {
        this(errorCode.getCode(), null, errorCode.getMessage());
    }
    
    
}


